 

#include "stdafx.h"
#include "TempMat.h"
#include "matUiEditor.h"


//static CTempMatFactory gCTempMatFactory;
TempMat::TempMat(const Ogre::String & tempmatName,const Ogre::String & matName,matUiEditor * pMat) : BaseMat(matName,pMat)
{
	m_tempmatName = tempmatName;
	m_MatName     =  matName;
	if (m_tempmatName != ""&&m_MatName !="")
	{
		MaterialPtr 	Ptr = MaterialManager::getSingleton().getByName(tempmatName);
		if (Ptr.isNull()==false)
		{
			m_MaterialPtr = Ptr->clone(m_MatName,true,"ProjectResources");
		}
		
	}
}

TempMat::~TempMat(void)
{
}
void TempMat::init(const Ogre::String & matName)
{
	m_MatName     =  matName;
	if (m_tempmatName != ""&&m_MatName != "")
	{

		if (!m_MaterialPtr.isNull())
		{
			if (m_MaterialPtr->getName() == m_MatName)
			{
				return;
			}
			else
			{
				MaterialManager::getSingleton().remove(m_MaterialPtr->getName());
			}
		}
		  m_MaterialPtr = MaterialManager::getSingleton().getByName(matName);
 
	}
}


void TempMat::loadMaxXml(Ogre::String &strloadMaxXml, Ogre::String &strMatBuffer)
{
}
 